/**
 * 
 */
package com.lz.ovuola.util.codec;

import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.digest.DigestUtils;

/**
 * @author fz
 *
 */
public class EncryptionUtils {

	private EncryptionUtils() throws Exception {
		throw new Exception("禁止反射创建EncryptionUtils实例");
	}

	public static final String base64Encode(String data) {
		return Base64.encodeBase64String(data.getBytes());
	}

	public static final byte[] base64Decode(String data) {
		return Base64.decodeBase64(data.getBytes());
	}

	public static final String md5(String data) {
		return DigestUtils.md5Hex(data);
	}

	public static final String sha1(String data) {
		return DigestUtils.sha1Hex(data);
	}

	public static final String sha256Hex(String data) {
		return DigestUtils.sha256Hex(data);
	}

	// public static void main(String[] args) {
	// System.out.println(md5("123456"));
	// System.out
	// .println(base64Encode("18145742165:62d6041341e20fc33da99a29117222f6"));
	// }
}
